package com.hdu.seckilldemo.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class RespBean {
    private long code;
    private String message;
    private Object obj;
    //  成功的返回结果
    public static RespBean success(){
        return new RespBean(RespBeanEnum.SUCCESS.getCode(), RespBeanEnum.SUCCESS.getMessage(), null);
    }
    public static RespBean success(Object obj){
        return new RespBean(RespBeanEnum.SUCCESS.getCode(), RespBeanEnum.SUCCESS.getMessage(), obj);
    }
    public static RespBean error(RespBeanEnum beanEnum){
        return new RespBean(beanEnum.getCode(), beanEnum.getMessage(),null);
    }
    public static RespBean error(RespBeanEnum beanEnum,Object obj){
        return new RespBean(beanEnum.getCode(), beanEnum.getMessage(),obj);
    }
}
